home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / PROBLEMS / TASKWINDOW < prev   
Text File  |  1992-04-12  |  2KB  |  71 lines

  1. Article 207 of comp.sys.acorn:
  2. Path: rusmv1!ira.uka.de!sol.ctr.columbia.edu!lll-winken!uunet!mcsun!ukc!acorn!RMokady
  3. From: RMokady@acorn.co.uk (Ran Mokady)
  4. Newsgroups: comp.sys.acorn
  5. Subject: Re: Creation of a Taskwindow
  6. Message-ID: <6846@acorn.co.uk>
  7. Date: 6 May 91 00:26:32 GMT
  8. References: <1744@nlcvx.convex.nl>
  9. Sender: rmokady@acorn.co.uk
  10. Distribution: comp
  11. Organization: Acorn Computers Ltd, Cambridge, England
  12. Lines: 60
  13.  
  14. In article <1744@nlcvx.convex.nl> boerhout@convex.nl (Jan Boerhout) writes:
  15.  
  16. >I want to be able to start a program in a task window from an obey file
  17. >without having to create a task window manually using !Edit and without
  18. >having to start my program manually in this window.
  19. >
  20. >Has somebody figured out how to do this?
  21.  
  22. I don't think there is a way of doing it properly, but you could try the
  23. following BASIC program:  
  24.  
  25. REM >Task
  26. SYS "OS_GetEnv" TO command$
  27. D%=INSTR(command$,"$")
  28. IF D%=0 THEN ERROR EXT 0,"Missing TaskWindow command"
  29. DIM block% 256, task% 5
  30. $task%="TASK"
  31. block%!0=36
  32. block%!12=0
  33. block%!16=&808c5
  34. $(block%+20)="ShellCLI_Task"+CHR$0
  35. SYS "Wimp_Initialise",200,!task%,"TaskWindow"
  36. SYS "Wimp_SendMessage",17,block%,0
  37. SYS "OS_Byte",138,0,13
  38. FOR I%=D%+1 TO LEN(command$)
  39.  SYS "OS_Byte",138,0,ASC(MID$(command$,I%,1))
  40. NEXT I%
  41. SYS "OS_Byte",138,0,13
  42. REPEAT SYS "Wimp_Poll",0,block% TO R%:UNTIL R%=0
  43. END
  44.           
  45. Save it as "Task" in your library directory, and then in your obey file put:
  46.  
  47. Task $<command>    
  48.  
  49. Where <command> is the command you want executed in the task window.
  50.  
  51. For this to work you have to have !Edit and the TaskWindow modules loaded.
  52.  
  53.   The BASIC program sends a message to !Edit telling it to open a
  54. TaskWindow, it then inserts the anything following the $ on the command used
  55. to start it into the keyboard buffer, so that it is picked up by !Edit as
  56. input for the task. The first OS_Byte 138,0,13 is to reduce the risk of
  57. something being typed in from the keyboard before it has a chance to insert
  58. the codes into the buffer, but it is still not perfect if you happen to be
  59. typing things in while it is running. The last line before the END is used
  60. to enable you to have two *Task commands one after the other, if it is
  61. missed out, two task windows will be opened, but both commands will be run
  62. in the same window.
  63.  
  64.  If anyone knows of a better way to do this, please let me know !
  65.  
  66.                                  Ran.
  67.  
  68.  
  69.  
  70.  
  71.